3.79 \(\int \frac{(a+b \tan (e+f x)) (A+B \tan (e+f x)+C \tan ^2(e+f x))}{(c+d \tan (e+f x))^2} \, dx\)

Optimal. Leaf size=292 \[ \frac{(b c-a d) \left (A d^2-B c d+c^2 C\right )}{d^2 f \left (c^2+d^2\right ) (c+d \tan (e+f x))}+\frac{\left (a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (-c^2 d^2 (A-3 C)+A d^4-2 B c d^3+c^4 C\right )\right ) \log (c+d \tan (e+f x))}{d^2 f \left (c^2+d^2\right )^2}-\frac{\log (\cos (e+f x)) \left (-A \left (2 a c d-b \left (c^2-d^2\right )\right )+a \left (B c^2-B d^2+2 c C d\right )-b \left (-2 B c d+c^2 C-C d^2\right )\right )}{f \left (c^2+d^2\right )^2}-\frac{x \left (a \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-b \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right )}{\left (c^2+d^2\right )^2} \]

[Out]

-(((a*(c^2*C - 2*B*c*d - C*d^2 - A*(c^2 - d^2)) - b*(2*c*(A - C)*d - B*(c^2 - d^2)))*x)/(c^2 + d^2)^2) - ((a*(
B*c^2 + 2*c*C*d - B*d^2) - b*(c^2*C - 2*B*c*d - C*d^2) - A*(2*a*c*d - b*(c^2 - d^2)))*Log[Cos[e + f*x]])/((c^2
 + d^2)^2*f) + ((b*(c^4*C - c^2*(A - 3*C)*d^2 - 2*B*c*d^3 + A*d^4) + a*d^2*(2*c*(A - C)*d - B*(c^2 - d^2)))*Lo
g[c + d*Tan[e + f*x]])/(d^2*(c^2 + d^2)^2*f) + ((b*c - a*d)*(c^2*C - B*c*d + A*d^2))/(d^2*(c^2 + d^2)*f*(c + d
*Tan[e + f*x]))

________________________________________________________________________________________

Rubi [A]  time = 0.553893, antiderivative size = 288, normalized size of antiderivative = 0.99, number of steps used = 5, number of rules used = 5, integrand size = 43, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.116, Rules used = {3635, 3626, 3617, 31, 3475} \[ \frac{(b c-a d) \left (A d^2-B c d+c^2 C\right )}{d^2 f \left (c^2+d^2\right ) (c+d \tan (e+f x))}+\frac{\left (a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (-c^2 d^2 (A-3 C)+A d^4-2 B c d^3+c^4 C\right )\right ) \log (c+d \tan (e+f x))}{d^2 f \left (c^2+d^2\right )^2}+\frac{\log (\cos (e+f x)) \left (2 a A c d-a B \left (c^2-d^2\right )-2 a c C d-A b \left (c^2-d^2\right )+b \left (-2 B c d+c^2 C-C d^2\right )\right )}{f \left (c^2+d^2\right )^2}-\frac{x \left (a \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-b \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right )}{\left (c^2+d^2\right )^2} \]

Antiderivative was successfully verified.

[In]

Int[((a + b*Tan[e + f*x])*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(c + d*Tan[e + f*x])^2,x]

[Out]

-(((a*(c^2*C - 2*B*c*d - C*d^2 - A*(c^2 - d^2)) - b*(2*c*(A - C)*d - B*(c^2 - d^2)))*x)/(c^2 + d^2)^2) + ((2*a
*A*c*d - 2*a*c*C*d - A*b*(c^2 - d^2) - a*B*(c^2 - d^2) + b*(c^2*C - 2*B*c*d - C*d^2))*Log[Cos[e + f*x]])/((c^2
 + d^2)^2*f) + ((b*(c^4*C - c^2*(A - 3*C)*d^2 - 2*B*c*d^3 + A*d^4) + a*d^2*(2*c*(A - C)*d - B*(c^2 - d^2)))*Lo
g[c + d*Tan[e + f*x]])/(d^2*(c^2 + d^2)^2*f) + ((b*c - a*d)*(c^2*C - B*c*d + A*d^2))/(d^2*(c^2 + d^2)*f*(c + d
*Tan[e + f*x]))

Rule 3635

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_)*((A_.) + (B_.)*tan[(e
_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> -Simp[((b*c - a*d)*(c^2*C - B*c*d + A*d^2)*
(c + d*Tan[e + f*x])^(n + 1))/(d^2*f*(n + 1)*(c^2 + d^2)), x] + Dist[1/(d*(c^2 + d^2)), Int[(c + d*Tan[e + f*x
])^(n + 1)*Simp[a*d*(A*c - c*C + B*d) + b*(c^2*C - B*c*d + A*d^2) + d*(A*b*c + a*B*c - b*c*C - a*A*d + b*B*d +
 a*C*d)*Tan[e + f*x] + b*C*(c^2 + d^2)*Tan[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C}, x] &&
NeQ[b*c - a*d, 0] && NeQ[c^2 + d^2, 0] && LtQ[n, -1]

Rule 3626

Int[((A_) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2)/((a_.) + (b_.)*tan[(e_.) + (f_.)*
(x_)]), x_Symbol] :> Simp[((a*A + b*B - a*C)*x)/(a^2 + b^2), x] + (Dist[(A*b^2 - a*b*B + a^2*C)/(a^2 + b^2), I
nt[(1 + Tan[e + f*x]^2)/(a + b*Tan[e + f*x]), x], x] - Dist[(A*b - a*B - b*C)/(a^2 + b^2), Int[Tan[e + f*x], x
], x]) /; FreeQ[{a, b, e, f, A, B, C}, x] && NeQ[A*b^2 - a*b*B + a^2*C, 0] && NeQ[a^2 + b^2, 0] && NeQ[A*b - a
*B - b*C, 0]

Rule 3617

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_) + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Dist[
A/(b*f), Subst[Int[(a + x)^m, x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, A, C, m}, x] && EqQ[A, C]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \frac{(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx &=\frac{(b c-a d) \left (c^2 C-B c d+A d^2\right )}{d^2 \left (c^2+d^2\right ) f (c+d \tan (e+f x))}+\frac{\int \frac{a d (A c-c C+B d)+b \left (c^2 C-B c d+A d^2\right )+d (A b c+a B c-b c C-a A d+b B d+a C d) \tan (e+f x)+b C \left (c^2+d^2\right ) \tan ^2(e+f x)}{c+d \tan (e+f x)} \, dx}{d \left (c^2+d^2\right )}\\ &=-\frac{\left (a \left (c^2 C-2 B c d-C d^2-A \left (c^2-d^2\right )\right )-b \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) x}{\left (c^2+d^2\right )^2}+\frac{(b c-a d) \left (c^2 C-B c d+A d^2\right )}{d^2 \left (c^2+d^2\right ) f (c+d \tan (e+f x))}-\frac{\left (2 a A c d-2 a c C d-A b \left (c^2-d^2\right )-a B \left (c^2-d^2\right )+b \left (c^2 C-2 B c d-C d^2\right )\right ) \int \tan (e+f x) \, dx}{\left (c^2+d^2\right )^2}+\frac{\left (b \left (c^4 C-c^2 (A-3 C) d^2-2 B c d^3+A d^4\right )+a d^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) \int \frac{1+\tan ^2(e+f x)}{c+d \tan (e+f x)} \, dx}{d \left (c^2+d^2\right )^2}\\ &=-\frac{\left (a \left (c^2 C-2 B c d-C d^2-A \left (c^2-d^2\right )\right )-b \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) x}{\left (c^2+d^2\right )^2}+\frac{\left (2 a A c d-2 a c C d-A b \left (c^2-d^2\right )-a B \left (c^2-d^2\right )+b \left (c^2 C-2 B c d-C d^2\right )\right ) \log (\cos (e+f x))}{\left (c^2+d^2\right )^2 f}+\frac{(b c-a d) \left (c^2 C-B c d+A d^2\right )}{d^2 \left (c^2+d^2\right ) f (c+d \tan (e+f x))}+\frac{\left (b \left (c^4 C-c^2 (A-3 C) d^2-2 B c d^3+A d^4\right )+a d^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) \operatorname{Subst}\left (\int \frac{1}{c+x} \, dx,x,d \tan (e+f x)\right )}{d^2 \left (c^2+d^2\right )^2 f}\\ &=-\frac{\left (a \left (c^2 C-2 B c d-C d^2-A \left (c^2-d^2\right )\right )-b \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) x}{\left (c^2+d^2\right )^2}+\frac{\left (2 a A c d-2 a c C d-A b \left (c^2-d^2\right )-a B \left (c^2-d^2\right )+b \left (c^2 C-2 B c d-C d^2\right )\right ) \log (\cos (e+f x))}{\left (c^2+d^2\right )^2 f}+\frac{\left (b \left (c^4 C-c^2 (A-3 C) d^2-2 B c d^3+A d^4\right )+a d^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) \log (c+d \tan (e+f x))}{d^2 \left (c^2+d^2\right )^2 f}+\frac{(b c-a d) \left (c^2 C-B c d+A d^2\right )}{d^2 \left (c^2+d^2\right ) f (c+d \tan (e+f x))}\\ \end{align*}

Mathematica [C]  time = 6.33632, size = 606, normalized size = 2.08 \[ \frac{-2 i c \tan ^{-1}(\tan (e+f x)) (c+d \tan (e+f x)) \left (a d^2 \left (2 c d (A-C)+B \left (d^2-c^2\right )\right )+b \left (-c^2 d^2 (A-3 C)+A d^4-2 B c d^3+c^4 C\right )\right )+c^2 \left (2 (c+i d)^2 (e+f x) \left (a d^2 (A-i B-C)+b \left (d^2 (-B-i A)+i c^2 C+2 c C d\right )\right )+\left (a d^2 \left (2 c d (A-C)+B \left (d^2-c^2\right )\right )+b \left (-c^2 d^2 (A-3 C)+A d^4-2 B c d^3+c^4 C\right )\right ) \log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right )-2 b C \left (c^2+d^2\right )^2 \log (\cos (e+f x))\right )+d \tan (e+f x) \left (2 (c+i d) \left (a d \left (-c^2 d (-A (e+f x)+B (i e+i f x+1)+C (e+f x+i))+c d^2 (A (i e+i f x+1)+B (e+f x+i)-i C (e+f x))-i A d^3+c^3 C\right )+b c \left (-i c d^2 (A (e+f x-i)-i B (e+f x+i)-2 C (e+f x))+d^3 (A (e+f x+i)-i B (e+f x))+c^2 d (B+C (e+f x+i))+i c^3 C (e+f x+i)\right )\right )+c \left (a d^2 \left (2 c d (A-C)+B \left (d^2-c^2\right )\right )+b \left (-c^2 d^2 (A-3 C)+A d^4-2 B c d^3+c^4 C\right )\right ) \log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right )-2 b c C \left (c^2+d^2\right )^2 \log (\cos (e+f x))\right )}{2 c d^2 f \left (c^2+d^2\right )^2 (c+d \tan (e+f x))} \]

Antiderivative was successfully verified.

[In]

Integrate[((a + b*Tan[e + f*x])*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(c + d*Tan[e + f*x])^2,x]

[Out]

(c^2*(2*(c + I*d)^2*(a*(A - I*B - C)*d^2 + b*(I*c^2*C + 2*c*C*d + ((-I)*A - B)*d^2))*(e + f*x) - 2*b*C*(c^2 +
d^2)^2*Log[Cos[e + f*x]] + (b*(c^4*C - c^2*(A - 3*C)*d^2 - 2*B*c*d^3 + A*d^4) + a*d^2*(2*c*(A - C)*d + B*(-c^2
 + d^2)))*Log[(c*Cos[e + f*x] + d*Sin[e + f*x])^2]) + d*(2*(c + I*d)*(b*c*(I*c^3*C*(I + e + f*x) + d^3*((-I)*B
*(e + f*x) + A*(I + e + f*x)) - I*c*d^2*(-2*C*(e + f*x) + A*(-I + e + f*x) - I*B*(I + e + f*x)) + c^2*d*(B + C
*(I + e + f*x))) + a*d*(c^3*C - I*A*d^3 + c*d^2*(A*(1 + I*e + I*f*x) - I*C*(e + f*x) + B*(I + e + f*x)) - c^2*
d*(B*(1 + I*e + I*f*x) - A*(e + f*x) + C*(I + e + f*x)))) - 2*b*c*C*(c^2 + d^2)^2*Log[Cos[e + f*x]] + c*(b*(c^
4*C - c^2*(A - 3*C)*d^2 - 2*B*c*d^3 + A*d^4) + a*d^2*(2*c*(A - C)*d + B*(-c^2 + d^2)))*Log[(c*Cos[e + f*x] + d
*Sin[e + f*x])^2])*Tan[e + f*x] - (2*I)*c*(b*(c^4*C - c^2*(A - 3*C)*d^2 - 2*B*c*d^3 + A*d^4) + a*d^2*(2*c*(A -
 C)*d + B*(-c^2 + d^2)))*ArcTan[Tan[e + f*x]]*(c + d*Tan[e + f*x]))/(2*c*d^2*(c^2 + d^2)^2*f*(c + d*Tan[e + f*
x]))

________________________________________________________________________________________

Maple [B]  time = 0.058, size = 948, normalized size = 3.3 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e))^2,x)

[Out]

-1/2/f/(c^2+d^2)^2*ln(1+tan(f*x+e)^2)*A*b*d^2+1/2/f/(c^2+d^2)^2*ln(1+tan(f*x+e)^2)*B*a*c^2-1/2/f/(c^2+d^2)^2*l
n(1+tan(f*x+e)^2)*B*a*d^2-1/2/f/(c^2+d^2)^2*ln(1+tan(f*x+e)^2)*C*b*c^2+1/2/f/(c^2+d^2)^2*ln(1+tan(f*x+e)^2)*C*
b*d^2+3/f/(c^2+d^2)^2*ln(c+d*tan(f*x+e))*C*b*c^2+1/f/(c^2+d^2)/(c+d*tan(f*x+e))*A*b*c+1/f/(c^2+d^2)/(c+d*tan(f
*x+e))*B*a*c-1/f/(c^2+d^2)^2*ln(c+d*tan(f*x+e))*B*a*c^2-2/f/(c^2+d^2)^2*C*arctan(tan(f*x+e))*b*c*d-1/f/d/(c^2+
d^2)/(c+d*tan(f*x+e))*B*b*c^2-1/f/d/(c^2+d^2)/(c+d*tan(f*x+e))*C*a*c^2+1/f/d^2/(c^2+d^2)/(c+d*tan(f*x+e))*C*b*
c^3+1/f/(c^2+d^2)^2*ln(1+tan(f*x+e)^2)*B*b*c*d+1/f/(c^2+d^2)^2*ln(1+tan(f*x+e)^2)*C*a*c*d+2/f/(c^2+d^2)^2*d*ln
(c+d*tan(f*x+e))*A*a*c-1/f/(c^2+d^2)^2*ln(1+tan(f*x+e)^2)*A*a*c*d-2/f/(c^2+d^2)^2*d*ln(c+d*tan(f*x+e))*B*b*c-2
/f/(c^2+d^2)^2*d*ln(c+d*tan(f*x+e))*C*a*c+1/f/(c^2+d^2)^2/d^2*ln(c+d*tan(f*x+e))*C*b*c^4+2/f/(c^2+d^2)^2*B*arc
tan(tan(f*x+e))*a*c*d+2/f/(c^2+d^2)^2*A*arctan(tan(f*x+e))*b*c*d-1/f*d/(c^2+d^2)/(c+d*tan(f*x+e))*A*a+1/f/(c^2
+d^2)^2*d^2*ln(c+d*tan(f*x+e))*A*b+1/f/(c^2+d^2)^2*d^2*ln(c+d*tan(f*x+e))*B*a-1/f/(c^2+d^2)^2*ln(c+d*tan(f*x+e
))*A*b*c^2-1/f/(c^2+d^2)^2*B*arctan(tan(f*x+e))*b*c^2+1/f/(c^2+d^2)^2*B*arctan(tan(f*x+e))*b*d^2-1/f/(c^2+d^2)
^2*C*arctan(tan(f*x+e))*a*c^2+1/f/(c^2+d^2)^2*C*arctan(tan(f*x+e))*a*d^2+1/f/(c^2+d^2)^2*A*arctan(tan(f*x+e))*
a*c^2-1/f/(c^2+d^2)^2*A*arctan(tan(f*x+e))*a*d^2+1/2/f/(c^2+d^2)^2*ln(1+tan(f*x+e)^2)*A*b*c^2

________________________________________________________________________________________

Maxima [A]  time = 1.48702, size = 431, normalized size = 1.48 \begin{align*} \frac{\frac{2 \,{\left ({\left ({\left (A - C\right )} a - B b\right )} c^{2} + 2 \,{\left (B a +{\left (A - C\right )} b\right )} c d -{\left ({\left (A - C\right )} a - B b\right )} d^{2}\right )}{\left (f x + e\right )}}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} + \frac{2 \,{\left (C b c^{4} -{\left (B a +{\left (A - 3 \, C\right )} b\right )} c^{2} d^{2} + 2 \,{\left ({\left (A - C\right )} a - B b\right )} c d^{3} +{\left (B a + A b\right )} d^{4}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{4} d^{2} + 2 \, c^{2} d^{4} + d^{6}} + \frac{{\left ({\left (B a +{\left (A - C\right )} b\right )} c^{2} - 2 \,{\left ({\left (A - C\right )} a - B b\right )} c d -{\left (B a +{\left (A - C\right )} b\right )} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} + \frac{2 \,{\left (C b c^{3} - A a d^{3} -{\left (C a + B b\right )} c^{2} d +{\left (B a + A b\right )} c d^{2}\right )}}{c^{3} d^{2} + c d^{4} +{\left (c^{2} d^{3} + d^{5}\right )} \tan \left (f x + e\right )}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

1/2*(2*(((A - C)*a - B*b)*c^2 + 2*(B*a + (A - C)*b)*c*d - ((A - C)*a - B*b)*d^2)*(f*x + e)/(c^4 + 2*c^2*d^2 +
d^4) + 2*(C*b*c^4 - (B*a + (A - 3*C)*b)*c^2*d^2 + 2*((A - C)*a - B*b)*c*d^3 + (B*a + A*b)*d^4)*log(d*tan(f*x +
 e) + c)/(c^4*d^2 + 2*c^2*d^4 + d^6) + ((B*a + (A - C)*b)*c^2 - 2*((A - C)*a - B*b)*c*d - (B*a + (A - C)*b)*d^
2)*log(tan(f*x + e)^2 + 1)/(c^4 + 2*c^2*d^2 + d^4) + 2*(C*b*c^3 - A*a*d^3 - (C*a + B*b)*c^2*d + (B*a + A*b)*c*
d^2)/(c^3*d^2 + c*d^4 + (c^2*d^3 + d^5)*tan(f*x + e)))/f

________________________________________________________________________________________

Fricas [A]  time = 1.83332, size = 1095, normalized size = 3.75 \begin{align*} \frac{2 \, C b c^{3} d^{2} - 2 \, A a d^{5} - 2 \,{\left (C a + B b\right )} c^{2} d^{3} + 2 \,{\left (B a + A b\right )} c d^{4} + 2 \,{\left ({\left ({\left (A - C\right )} a - B b\right )} c^{3} d^{2} + 2 \,{\left (B a +{\left (A - C\right )} b\right )} c^{2} d^{3} -{\left ({\left (A - C\right )} a - B b\right )} c d^{4}\right )} f x +{\left (C b c^{5} -{\left (B a +{\left (A - 3 \, C\right )} b\right )} c^{3} d^{2} + 2 \,{\left ({\left (A - C\right )} a - B b\right )} c^{2} d^{3} +{\left (B a + A b\right )} c d^{4} +{\left (C b c^{4} d -{\left (B a +{\left (A - 3 \, C\right )} b\right )} c^{2} d^{3} + 2 \,{\left ({\left (A - C\right )} a - B b\right )} c d^{4} +{\left (B a + A b\right )} d^{5}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac{d^{2} \tan \left (f x + e\right )^{2} + 2 \, c d \tan \left (f x + e\right ) + c^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) -{\left (C b c^{5} + 2 \, C b c^{3} d^{2} + C b c d^{4} +{\left (C b c^{4} d + 2 \, C b c^{2} d^{3} + C b d^{5}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac{1}{\tan \left (f x + e\right )^{2} + 1}\right ) - 2 \,{\left (C b c^{4} d - A a c d^{4} -{\left (C a + B b\right )} c^{3} d^{2} +{\left (B a + A b\right )} c^{2} d^{3} -{\left ({\left ({\left (A - C\right )} a - B b\right )} c^{2} d^{3} + 2 \,{\left (B a +{\left (A - C\right )} b\right )} c d^{4} -{\left ({\left (A - C\right )} a - B b\right )} d^{5}\right )} f x\right )} \tan \left (f x + e\right )}{2 \,{\left ({\left (c^{4} d^{3} + 2 \, c^{2} d^{5} + d^{7}\right )} f \tan \left (f x + e\right ) +{\left (c^{5} d^{2} + 2 \, c^{3} d^{4} + c d^{6}\right )} f\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

1/2*(2*C*b*c^3*d^2 - 2*A*a*d^5 - 2*(C*a + B*b)*c^2*d^3 + 2*(B*a + A*b)*c*d^4 + 2*(((A - C)*a - B*b)*c^3*d^2 +
2*(B*a + (A - C)*b)*c^2*d^3 - ((A - C)*a - B*b)*c*d^4)*f*x + (C*b*c^5 - (B*a + (A - 3*C)*b)*c^3*d^2 + 2*((A -
C)*a - B*b)*c^2*d^3 + (B*a + A*b)*c*d^4 + (C*b*c^4*d - (B*a + (A - 3*C)*b)*c^2*d^3 + 2*((A - C)*a - B*b)*c*d^4
 + (B*a + A*b)*d^5)*tan(f*x + e))*log((d^2*tan(f*x + e)^2 + 2*c*d*tan(f*x + e) + c^2)/(tan(f*x + e)^2 + 1)) -
(C*b*c^5 + 2*C*b*c^3*d^2 + C*b*c*d^4 + (C*b*c^4*d + 2*C*b*c^2*d^3 + C*b*d^5)*tan(f*x + e))*log(1/(tan(f*x + e)
^2 + 1)) - 2*(C*b*c^4*d - A*a*c*d^4 - (C*a + B*b)*c^3*d^2 + (B*a + A*b)*c^2*d^3 - (((A - C)*a - B*b)*c^2*d^3 +
 2*(B*a + (A - C)*b)*c*d^4 - ((A - C)*a - B*b)*d^5)*f*x)*tan(f*x + e))/((c^4*d^3 + 2*c^2*d^5 + d^7)*f*tan(f*x
+ e) + (c^5*d^2 + 2*c^3*d^4 + c*d^6)*f)

________________________________________________________________________________________

Sympy [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: AttributeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)**2)/(c+d*tan(f*x+e))**2,x)

[Out]

Exception raised: AttributeError

________________________________________________________________________________________

Giac [A]  time = 1.62849, size = 713, normalized size = 2.44 \begin{align*} \frac{\frac{2 \,{\left (A a c^{2} - C a c^{2} - B b c^{2} + 2 \, B a c d + 2 \, A b c d - 2 \, C b c d - A a d^{2} + C a d^{2} + B b d^{2}\right )}{\left (f x + e\right )}}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} + \frac{{\left (B a c^{2} + A b c^{2} - C b c^{2} - 2 \, A a c d + 2 \, C a c d + 2 \, B b c d - B a d^{2} - A b d^{2} + C b d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} + \frac{2 \,{\left (C b c^{4} - B a c^{2} d^{2} - A b c^{2} d^{2} + 3 \, C b c^{2} d^{2} + 2 \, A a c d^{3} - 2 \, C a c d^{3} - 2 \, B b c d^{3} + B a d^{4} + A b d^{4}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{c^{4} d^{2} + 2 \, c^{2} d^{4} + d^{6}} - \frac{2 \,{\left (C b c^{4} \tan \left (f x + e\right ) - B a c^{2} d^{2} \tan \left (f x + e\right ) - A b c^{2} d^{2} \tan \left (f x + e\right ) + 3 \, C b c^{2} d^{2} \tan \left (f x + e\right ) + 2 \, A a c d^{3} \tan \left (f x + e\right ) - 2 \, C a c d^{3} \tan \left (f x + e\right ) - 2 \, B b c d^{3} \tan \left (f x + e\right ) + B a d^{4} \tan \left (f x + e\right ) + A b d^{4} \tan \left (f x + e\right ) + C a c^{4} + B b c^{4} - 2 \, B a c^{3} d - 2 \, A b c^{3} d + 2 \, C b c^{3} d + 3 \, A a c^{2} d^{2} - C a c^{2} d^{2} - B b c^{2} d^{2} + A a d^{4}\right )}}{{\left (c^{4} d + 2 \, c^{2} d^{3} + d^{5}\right )}{\left (d \tan \left (f x + e\right ) + c\right )}}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e))^2,x, algorithm="giac")

[Out]

1/2*(2*(A*a*c^2 - C*a*c^2 - B*b*c^2 + 2*B*a*c*d + 2*A*b*c*d - 2*C*b*c*d - A*a*d^2 + C*a*d^2 + B*b*d^2)*(f*x +
e)/(c^4 + 2*c^2*d^2 + d^4) + (B*a*c^2 + A*b*c^2 - C*b*c^2 - 2*A*a*c*d + 2*C*a*c*d + 2*B*b*c*d - B*a*d^2 - A*b*
d^2 + C*b*d^2)*log(tan(f*x + e)^2 + 1)/(c^4 + 2*c^2*d^2 + d^4) + 2*(C*b*c^4 - B*a*c^2*d^2 - A*b*c^2*d^2 + 3*C*
b*c^2*d^2 + 2*A*a*c*d^3 - 2*C*a*c*d^3 - 2*B*b*c*d^3 + B*a*d^4 + A*b*d^4)*log(abs(d*tan(f*x + e) + c))/(c^4*d^2
 + 2*c^2*d^4 + d^6) - 2*(C*b*c^4*tan(f*x + e) - B*a*c^2*d^2*tan(f*x + e) - A*b*c^2*d^2*tan(f*x + e) + 3*C*b*c^
2*d^2*tan(f*x + e) + 2*A*a*c*d^3*tan(f*x + e) - 2*C*a*c*d^3*tan(f*x + e) - 2*B*b*c*d^3*tan(f*x + e) + B*a*d^4*
tan(f*x + e) + A*b*d^4*tan(f*x + e) + C*a*c^4 + B*b*c^4 - 2*B*a*c^3*d - 2*A*b*c^3*d + 2*C*b*c^3*d + 3*A*a*c^2*
d^2 - C*a*c^2*d^2 - B*b*c^2*d^2 + A*a*d^4)/((c^4*d + 2*c^2*d^3 + d^5)*(d*tan(f*x + e) + c)))/f